Commit | Line | Data |
---|---|---|
ee49ff3d CE |
1 | // arcade controller thing |
2 | // Copyright (c) 2017 Clinton Ebadi <clinton@unknownlamer.org> | |
3 | // GPLv3 or (at your option) any later version | |
4 | // .. insert license text here ... | |
5 | ||
6 | use <obiscad/bcube.scad> | |
7 | ||
8 | $button_d = 28; | |
9 | ||
10 | module button (bezel = $button_d+4) { | |
11 | circle (d=$button_d); | |
12 | %circle(d=bezel); | |
13 | } | |
14 | ||
15 | js_width = 40; | |
16 | js_height = 85; | |
17 | ||
18 | module joystick () { | |
19 | bolt_d = 8; | |
20 | center_hole_d = 24; | |
21 | ||
22 | ||
23 | for (x = [0, js_width], y = [0, js_height]) { | |
24 | translate ([x, y, 0]) circle (d=bolt_d); // need slot instead | |
25 | } | |
26 | translate ([js_width/2, js_height/2, 0]) circle (d=center_hole_d); | |
27 | ||
28 | %square ([js_width, js_height]); // not right... | |
29 | } | |
30 | ||
31 | panel_w = 250; | |
32 | panel_h = 120; | |
33 | ||
34 | module box_base (x_offset=0, y_offset=0, c=2) { // shitty name | |
35 | offset (detal = c, chamfer=true) square ([panel_w+c+x_offset, panel_h+c+y_offset]); | |
36 | ||
37 | } | |
38 | ||
39 | box_h = 80; | |
40 | box_wall = 2; | |
41 | base_h = 5; | |
42 | // bcube parameters, clean up | |
43 | cr = 2; | |
44 | cres = 4; | |
45 | ||
46 | module betterbox_walls () { | |
47 | difference() { | |
48 | ||
49 | bcube([panel_w, panel_h, box_h-base_h], cr, cres); | |
50 | bcube([panel_w-box_wall, panel_h-box_wall, box_h], cr, cres); | |
51 | } | |
52 | } | |
53 | ||
54 | module betterbox_base () { | |
55 | bcube([panel_w, panel_h, base_h], cr, cres); | |
56 | } | |
57 | ||
58 | ||
59 | module betterbox () { | |
60 | betterbox_base (); | |
61 | translate ([0, 0, (box_h)/2]) betterbox_walls (); | |
62 | } | |
63 | ||
64 | betterbox (); | |
65 | ||
66 | module box () { | |
67 | ||
68 | linear_extrude (base_h) { | |
69 | box_base (); | |
70 | } | |
71 | translate ([0, 0, base_h]) linear_extrude (box_h) { | |
72 | difference () { | |
73 | box_base (); | |
74 | translate ([box_wall/2, box_wall/2, 0]) | |
75 | box_base (x_offset=-box_wall, y_offset=-box_wall); | |
76 | ||
77 | } | |
78 | } | |
79 | } | |
80 | ||
81 | //box (); | |
82 | ||
83 | ||
84 | ||
85 | module panel () { | |
86 | difference () { | |
87 | box_base (); | |
88 | translate ([15, panel_h/2-js_height/2, 0]) panel_layout (); | |
89 | } | |
90 | } | |
91 | ||
92 | //linear_extrude (6) panel (); | |
93 | ||
94 | ||
95 | ||
96 | // panel layout | |
97 | ||
98 | // http://smg.photobucket.com/user/ttooddddyy/media/neogeoMVS-4-25ver3-cpLayout.jpg.html | |
99 | ||
100 | module panel_layout () { | |
101 | joystick (); | |
102 | ||
103 | // p1, coin | |
104 | %translate ([140-$button_d, $button_d+65, 0]) { | |
105 | button (); | |
106 | translate ([$button_d+10, 0, 0]) button (); | |
107 | } | |
108 | ||
109 | // a, b, c, d | |
110 | translate ([js_width/2+$button_d/2+63.5, js_height/2, 0]) { | |
111 | button (); | |
112 | for (i = [ 1 : 3 ]) { | |
113 | translate ([i*($button_d+10)-5, 30, 0]) button (); | |
114 | } | |
115 | } | |
116 | } | |
117 | ||
118 | //panel_layout (); |